/**
 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.language = 'fr';
	// config.uiColor = '#AADC6E';

    config.resize_enabled = false;
    config.enterMode = CKEDITOR.ENTER_P;
    config.shiftEnterMode = CKEDITOR.ENTER_BR;
    config.removePlugins='elementspath';
    config.skin = 'bootstrapck';
    //config.allowedContent = true;//关闭标签过滤
    //config.fullPage = true;//允许包含html标签

    //添加插件，多个插件用逗号隔开//,autocorrect,mathjax
    // config.extraPlugins = 'codesnippet,mathjax,image2,uploadimage,autogrow,colordialog,tableresize,pbckcode,notificationaggregator,filetools,notification,quicktable,embed,autoembed,embedbase,autolink';
    config.extraPlugins = 'codesnippet,mathjax,image2,uploadimage,autogrow,colordialog,tableresize,pbckcode,notificationaggregator,filetools,notification,quicktable,embed,embedbase,autolink';
    //使用zenburn的代码高亮风格样式 PS:zenburn效果就是黑色背景
    //如果不设置着默认风格为default
    config.codeSnippet_theme = 'monokai_sublime';
    //config.height = "1024px";
    config.autoGrow_onStartup = true;
    config.autoGrow_minHeight = 1024;
    //config.imageResize.maxWidth = 800;
    //config.imageResize.maxHeight = 800;

    //config.image2_alignClasses = [ 'image-left', 'image-center', 'image-right' ];
    //config.image2_captionedClass = 'image-captioned';
    config.pasteFromWordPromptCleanup = true;
    //config.pasteFromWordRemoveStyle = true;

    config.scayt_autoStartup = false; //增加这一项即可去除ckeditor烦人的拼写检查

    //config.mathJaxLib = '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML';
    config.mathJaxLib = '/application/third_party/editor/MathJax-master/MathJax.js?config=TeX-AMS_HTML';

    config.format_tags = 'p;h1;h2;h3';

    //config.image_previewText=' '; //预览区域显示内容

    config.toolbar = [
        { name: 'basicstyles', items: ['Bold','Italic','Strike','-','RemoveFormat'] },
        { name: 'styles', items: [ 'Format' ] },
        //{ name: 'editing', items: ['AutoCorrect'] },
        { name: 'colors', items: [ 'TextColor' ] },
        { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent','Indent','-' ,'Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight'] },//,'Mathjax'
        { name: 'links', items: [ 'Link','Unlink' ] },
        { name: 'insert', items: [ 'Image','Embed','Table', 'HorizontalRule','CodeSnippet','Mathjax' ] },
        { name: 'clipboard', items: [ 'Undo', 'Redo'] }
    ];

    // Magic Line does not require any additional ACF settings.
            // We set config.extraAllowedContent because HTML code in this sample contains
            // a <div> element with custom styles that we would like to allow.
    config.extraAllowedContent = 'div{border,background,text-align}';

    //设置前景色的取值 plugins/colorbutton/plugin.js
    config.colorButton_colors = 'ff7e88,ffb940,6cbc64,51bbff,acacac,333';


    //是否在选择颜色时显示“其它颜色”选项plugins/colorbutton/plugin.js
    config.colorButton_enableMore =false;

    // Upload images to a CKFinder connector (note that the response type is set to JSON).
    // config.uploadUrl = '/application/third_party/editor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json';
    config.uploadUrl = '/files_manager/upload_ckeditor_image';

    // Configure your file manager integration. This example uses CKFinder 3 for PHP.
    config.filebrowserBrowseUrl = '/files_manager/upload_ckeditor_image';
    config.filebrowserImageBrowseUrl = '/files_manager/upload_ckeditor_image';
    //config.filebrowserFlashBrowseUrl = location.hash +'/ckfinder/ckfinder.html?Type=Flash';
    config.filebrowserUploadUrl = '/files_manager/upload_ckeditor_image';
    config.filebrowserImageUploadUrl = '/files_manager/upload_ckeditor_image';
    config.filebrowserFlashUploadUrl = location.hash +'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';

    // The following options are not necessary and are used here for presentation purposes only.
            // They configure the Styles drop-down list and widgets to use classes.

    config.stylesSet = [
        { name: 'Narrow image', type: 'widget', widget: 'image', attributes: { 'class': 'image-narrow' } },
        { name: 'Wide image', type: 'widget', widget: 'image', attributes: { 'class': 'image-wide' } },
        { name: 'Narrow media', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-narrow' } },
        { name: 'Centered media', type: 'widget', widget: 'embed', attributes: { 'class': 'embed-align-center' } }
    ];

    // Load the default contents.css file plus customizations for this sample.
    config.contentsCss = [ CKEDITOR.basePath + 'contents.css'];

    // Configure the Enhanced Image plugin to use classes instead of styles and to disable the
    // resizer (because image size is controlled by widget styles or the image takes maximum
    // 100% of the editor width).
    //config.image2_alignClasses = [ 'image-align-left', 'image-align-center', 'image-align-right' ];
    //config.image2_disableResizer = false;


    //quick table
    //config.qtStyle = { 'border-collapse' : 'collapse' };
    
};
